import httpAxios from '../utils/httpAxios'

// 登录
export const login = (name: string, pwd: string) => {
    return httpAxios.post('/login', { name, pwd })
}

// 获取数据
export const getlist = () => {
    return httpAxios.get('/list')
}

// 搜索
export const searchlist = (data: any) => {
    return httpAxios.post('/list/search', data)
}

// 新增
export const addList = (data: any) => {
    return httpAxios.post('/list/add', data)
}

// 删除
export const delList = (delid: number) => {
    return httpAxios.post('/list/del', { delid })
}

// 获取某一条数据
export const getlistdetail = (id: number) => {
    return httpAxios.post('/list/detail/' + id)
}

// 修改数据
export const geteditlist = (data: object) => {
    return httpAxios.post('/list/edit', data)
}

// 获取评论
export const getcommentlist = () => {
    return httpAxios.post('/pl')
}

// 添加评论
export const addpl = (author: string, content: string) => {
    return httpAxios.post('/pl/add', { author, content })
}

// 删除评论
export const delpl = (plid: number) => {
    return httpAxios.post('/pl/del', { plid })
}